class Redprint:
	def __init__(self, name):
		self.name = name
		#空列表用于传入的参数列表
		self.mound = []
	
	#参照蓝图中的route方法定义红图的route方法，视图函数的装饰器路由方法要用到	
	def route(self, rule, **options):
		def decorator(f):
			endpoint = options.pop("endpoint", f.__name__)
			self.mound.append((rule, endpoint, f, options))
			return f
			
		#最后返回装饰器对象
		return decorator
		
	#创建蓝图时要调用， bp为创建的蓝图对象	
	def register(self, bp, url_prefix=None):
		#url_prefix缺省时，默认为'/'+模块名
		if url_prefix is None:
			url_prefix = '/' + self.name
		for rule, endpoint, f, options in self.mound:
			rule = url_prefix + rule
			#调用蓝图中最核心的add_url_rule, 注意**options
			bp.add_url_rule(rule, endpoint, f, **options)